/*
 * Logger.cpp
 *
 */

#include "Logger.h"

Logger& Logger::getInstance() {
	static Logger instance;
	return instance;
}

void Logger::config(const std::string& path, Threshold threshold) {
	this->threshold = threshold;
	file.open(path.c_str(), std::fstream::in | std::fstream::out | std::fstream::trunc | std::fstream::binary);
}

void Logger::debug(const std::string& message) {
	if (file.is_open() && threshold <= DEBUG) {
		file << message << std::endl;
	}
}

void Logger::error(const std::string& message) {
	if (file.is_open() && threshold <= ERROR) {
		file << message << std::endl;
	}
}
